from django import forms
from django.db import models


# Create your models here.


class Student(models.Model):
    name = models.CharField(max_length=100)
    password = models.CharField(max_length=20)
    image = models.ImageField(upload_to='photos', blank=True)
    sex = models.IntegerField(blank=True)
    signature = models.CharField(max_length=100, blank=True)
    point = models.FloatField(blank=True)
    buyNum = models.IntegerField(blank=True)
    phone = models.CharField(max_length=100, blank=True)


class NeedList(models.Model):
    username = models.CharField(max_length=100)
    description = models.TextField()
    time = models.CharField(max_length=100)


class ProductList(models.Model):
    name = models.CharField(max_length=100)
    description = models.TextField()
    type = models.IntegerField()
    price = models.FloatField()
    num = models.IntegerField()
    seller = models.CharField(max_length=100)
    image = models.ImageField(upload_to='photos')
    sellerCode = models.ImageField(upload_to='photos')
    sellerPhone = models.CharField(max_length=100)
    timeAndPlace = models.TextField(blank=True)


class ShoppingCart(models.Model):
    username = models.CharField(max_length=100)
    productID = models.IntegerField()
    num = models.IntegerField()


class OrderList(models.Model):
    time = models.CharField(max_length=100)
    pid = models.IntegerField()
    buyerPhone = models.CharField(max_length=100)
    buyerUsername = models.CharField(max_length=100)
    sellerUsername = models.CharField(max_length=100)
    number = models.IntegerField()
    total = models.FloatField()
    # 评分
    point = models.FloatField(blank=True, null=True)
    # 是否确认订单
    isConfirmed = models.IntegerField()


class Comments(models.Model):
    time = models.CharField(max_length=100)
    username = models.CharField(max_length=100)
    pid = models.IntegerField()
    words = models.TextField()
